﻿<?xml version="1.0" encoding="utf-8" ?>
<DbDataRequest connection="$DBConnection$" type="$ForumDBType$" defaultFormatter="bizobj CompanyMembership(costs,appPrivileges)">
  <SqlStatement hasResults="true">
	  SELECT
		  m.id as companyMembershipId, m.isActive as companyMembershipIsActive
		  , m.name as companyMembershipName, m.description as companyMembershipDescription
		  ,m.isDefault as companyMembershipIsDefault,m.createsNewCompany as companyMembershipCreatesNewCompany
		  ,m.userVisibility as companyMembershipVisibility,m.minAge as companyMembershipMinAge
		  ,c.id as costsid, c.isDefault as costsisDefault, c.timeLength as coststimeLength
		  ,c.timeType as coststimeType, c.cost as costscost, c.description as costsdescription
		  ,p.id AS appPrivilegesid, p.privilegeLevel as privilege
	  FROM CompanyMemberships m
	  LEFT JOIN MembershipCosts c ON m.id = c.membershipId
	  LEFT JOIN PrivilegeLevel AS p ON m.id = p.userGroupId
	  WHERE m.companyId = @companyId
  </SqlStatement>
  <Param name="companyId" type="UniqueIdentifier" />
</DbDataRequest>